home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c
- Path: news.Stanford.EDU!microunity!toms
- From: toms@MicroUnity.com (Tom Sanders)
- Subject: Re: Floating point calculation order
- Message-ID: <DLpF0C.IH4@microunity.com>
- Sender: usenet@microunity.com (news id)
- Organization: MicroUnity Systems Engineering, Inc.
- References: <m0tedv8-0002eqC@sice.nsk.su> <3104c6d9.134061184@nntp.ix.netcom.com> <TANMOY.96Jan23144637@qcd.lanl.gov>
- Date: Wed, 24 Jan 1996 21:14:36 GMT
-
- In article <TANMOY.96Jan23144637@qcd.lanl.gov>, tanmoy@qcd.lanl.gov (Tanmoy Bhattacharya) writes:
- |> --text follows this line--
-
- |> possibilities.
- |>
- |> There is absolutely no ambiguity in `p * q / r', and no parentheses
- |> are necessary.
- |>
- |> gave a warning if I did have an equation that could be evaluated in more
- |> than 1 order (something I have not done in over 20 years).
- |>
- |> I am almost certain you write `a + b * c' contrary to your claim. Do
- |> you mean `a + (b * c)' or `(a + b) * c' when, if, you do it? If you do
- |> not, you are in a very small minority.
- |>
- |> Cheers
- |> Tanmoy
- |> --
- |> tanmoy@qcd.lanl.gov(128.165.23.46) DECNET:
-
- Sorry Tanmoy you'd be wrong, I do write `a + (b * c)' not `a + b * c' .
- Do I need to , no of course not. I prefer to for clarity. If I specify
- exactly what I want when I write it, there is little doubt in the future
- if I or someone else is debugging a problem. If I leave the parentheses
- out, I or someone else may wonder whether it was intended to be
- `(a + b) * c' and waste time in a useless direction.
-
- As to the original equation `p * q / r' , I would argue that parentheses
- are certainly necessary. There is a slight numeric difference between
- `(p * q) / r' and `p * (q / r)' . By specifying I am sure the order I
- prefer will be used no matter what compiler I am using.
-
- Tom Sanders
-
-